import BaseModel from "../../../cfw/mvc/BaseModel";
import ModelManager from "../../../cfw/mvc/ModelManager";
import ModuleManager from "../../../cfw/module/ModuleManager";
import SleepToyItemModel from "./SleepToyItemModel";
import StateItemModel from "../../player/model/StateItemModel";
import Player from "../../player/Player";
import { PlayerStateID } from "../../../public/Config";


export default class BadRoomManager extends BaseModel {

    private static ins: BadRoomManager;

    static instance() {
        if (!this.ins) {
            this.ins = new BadRoomManager()
        }
        return this.ins;
    }


    private bathMgr: ModelManager<SleepToyItemModel> = new ModelManager()

    protected playerState: StateItemModel
    constructor() {
        super();
        this.playerState = Player.instance().getStateItemModel(PlayerStateID.SLEEP)
        this.bathMgr.initWithData(ModuleManager.dataManager.get(SleepToyItemModel.CLASS_NAME), SleepToyItemModel)
    }

    addNum(item: SleepToyItemModel) {
        this.playerState.addNum(item.getCleanNum())
    }

    updateExp() {
        Player.instance().updateExp(this.playerState)
    }

    getList() {
        return this.bathMgr.getList()
    }

    getItem(id: number) {
        return this.bathMgr.getByID(id)
    }

    // update (dt) {}
}
